#include <stdio.h>
int main()
{
	int a = 12;
	int b = 18;
	while (b)
	{
		int temp = b;
		b = a % b;
		a = temp;
	}
	printf("%d\n", a);

	return 0;
}